home *** CD-ROM | disk | FTP | other *** search
/ Inter.Net 55-1 / Inter.Net 55-1.iso / CBuilder / Setup / BCB / data.z / rwlocale.h < prev    next >
Encoding:
C/C++ Source or Header  |  1998-02-09  |  21.0 KB  |  617 lines

  1. #ifndef __RWLOCALE_H
  2. #define __RWLOCALE_H
  3. #pragma option push -b -a4 -Vx- -Ve- -w-inl -w-aus -w-sig
  4. /***************************************************************************
  5.  *
  6.  * locale - Declarations for the Standard Library locale classes
  7.  *
  8.  *
  9.  ***************************************************************************
  10.  *
  11.  * (c) Copyright 1994, 1995 Rogue Wave Software, Inc.
  12.  * ALL RIGHTS RESERVED *
  13.  * The software and information contained herein are proprietary to, and
  14.  * comprise valuable trade secrets of, Rogue Wave Software, Inc., which
  15.  * intends to preserve as trade secrets such software and information.
  16.  * This software is furnished pursuant to a written license agreement and
  17.  * may be used, copied, transmitted, and stored only in accordance with
  18.  * the terms of such license and with the inclusion of the above copyright
  19.  * notice.  This software and information or any other copies thereof may
  20.  * not be provided or otherwise made available to any other person.
  21.  *
  22.  * Notwithstanding any other lease or license that may pertain to, or
  23.  * accompany the delivery of, this computer software and information, the
  24.  * rights of the Government regarding its use, reproduction and disclosure
  25.  * are as set forth in Section 52.227-19 of the FARS Computer
  26.  * Software-Restricted Rights clause.
  27.  *
  28.  * Use, duplication, or disclosure by the Government is subject to
  29.  * restrictions as set forth in subparagraph (c)(1)(ii) of the Rights in
  30.  * Technical Data and Computer Software clause at DFARS 252.227-7013.
  31.  * Contractor/Manufacturer is Rogue Wave Software, Inc.,
  32.  * P.O. Box 2328, Corvallis, Oregon 97339.
  33.  *
  34.  * This computer software and information is distributed with "restricted
  35.  * rights."  Use, duplication or disclosure is subject to restrictions as
  36.  * set forth in NASA FAR SUP 18-52.227-79 (April 1985) "Commercial
  37.  * Computer Software-Restricted Rights (April 1985)."  If the Clause at
  38.  * 18-52.227-74 "Rights in Data General" is specified in the contract,
  39.  * then the "Alternate III" clause applies.
  40.  *
  41.  **************************************************************************/
  42.  
  43. #ifndef __STD_RWLOCALE__
  44. #define __STD_RWLOCALE__ 1
  45.  
  46. #ifndef __STD_RWCOMPILER_H__
  47. #include <stdcomp.h>
  48. #endif
  49.  
  50. #ifndef __STD_STRING__
  51. #include <string>
  52. #endif
  53.  
  54. #ifndef __STD_IOSFWD__
  55. #include <iosfwd>
  56. #endif
  57.  
  58. #ifndef _RWSTD_NO_NEW_HEADER
  59. #include <ctime>
  60. #else
  61. #include <time.h>
  62. #endif
  63.  
  64. #ifndef _RWSTD_NO_BAD_CAST
  65. #include <typeinfo>
  66. #endif
  67.  
  68. // In case these are (wrongly!) defined as macros in <cctype>.
  69.  
  70. #undef isspace
  71. #undef isprint
  72. #undef iscntrl
  73. #undef isupper
  74. #undef islower
  75. #undef isalpha
  76. #undef isdigit
  77. #undef ispunct
  78. #undef isxdigit
  79. #undef isalnum
  80. #undef isgraph
  81. #undef toupper
  82. #undef tolower
  83.  
  84.  
  85. #ifndef _RWSTD_NO_NAMESPACE
  86. namespace __rwstd {
  87. #endif
  88.  
  89. extern const char _RWSTDExportFunc(*) __rw_LocaleNotPresent;
  90.  
  91. #ifndef _RWSTD_NO_NAMESPACE
  92.  } namespace std {
  93. #endif
  94.  
  95. // Forward declarations of functions and classes specified by the locale clause
  96. // of the C++ Standard Library working paper.
  97.  
  98. class _RWSTDExport locale;
  99.  
  100. template <class charT> inline bool isspace  (charT c, const locale&);
  101. template <class charT> inline bool isprint  (charT c, const locale&);
  102. template <class charT> inline bool iscntrl  (charT c, const locale&);
  103. template <class charT> inline bool isupper  (charT c, const locale&);
  104. template <class charT> inline bool islower  (charT c, const locale&);
  105. template <class charT> inline bool isalpha  (charT c, const locale&);
  106. template <class charT> inline bool isdigit  (charT c, const locale&);
  107. template <class charT> inline bool ispunct  (charT c, const locale&);
  108. template <class charT> inline bool isxdigit (charT c, const locale&);
  109. template <class charT> inline bool isalnum  (charT c, const locale&);
  110. template <class charT> inline bool isgraph  (charT c, const locale&);
  111.  
  112. template <class charT> inline charT toupper (charT c, const locale&);
  113. template <class charT> inline charT tolower (charT c, const locale&);
  114.  
  115. #ifndef _RWSTD_NO_TEMPLATE_ON_RETURN_TYPE
  116.   template <class Facet> inline const Facet& use_facet (const locale&);
  117.   template <class Facet>
  118.     inline bool has_facet (const locale&) _RWSTD_THROW_SPEC_NULL;
  119. #else
  120.   template <class Facet> inline const Facet& use_facet (const locale&, Facet*);
  121.   template <class Facet>
  122.     inline bool has_facet (const locale&, Facet*) _RWSTD_THROW_SPEC_NULL;
  123. #endif /* _RWSTD_NO_TEMPLATE_ON_RETURN_TYPE */
  124.  
  125. class _RWSTDExport ctype_base;
  126. class _RWSTDExport codecvt_base;
  127. class _RWSTDExport time_base;
  128. class _RWSTDExport money_base;
  129. class _RWSTDExport messages_base;
  130.  
  131. template <class charT> class _RWSTDExportTemplate ctype;
  132. _RWSTD_TEMPLATE class _RWSTDExport ctype<char>;
  133. _RWSTD_TEMPLATE class _RWSTDExport ctype<wchar_t>;
  134. template <class charT> class _RWSTDExportTemplate ctype_byname;
  135. template <class internT, class externT, class stateT>
  136.     class _RWSTDExportTemplate codecvt;
  137. template <class internT, class externT, class stateT>
  138.     class _RWSTDExportTemplate codecvt_byname;
  139. template <class charT,
  140.     class InputIterator _RWSTD_COMPLEX_DEFAULT(istreambuf_iterator<charT>)>
  141.     class _RWSTDExportTemplate num_get;
  142. template <class charT,
  143.     class OutputIterator _RWSTD_COMPLEX_DEFAULT(ostreambuf_iterator<charT>)>
  144.     class _RWSTDExportTemplate num_put;
  145. template <class charT> class _RWSTDExportTemplate numpunct;
  146. template <class charT> class _RWSTDExportTemplate numpunct_byname;
  147. template <class charT> class _RWSTDExportTemplate collate;
  148. template <class charT> class _RWSTDExportTemplate collate_byname;
  149. template <class charT,
  150.     class InputIterator _RWSTD_COMPLEX_DEFAULT(istreambuf_iterator<charT>)>
  151.     class _RWSTDExportTemplate time_get;
  152. template <class charT,
  153.     class InputIterator _RWSTD_COMPLEX_DEFAULT(istreambuf_iterator<charT>)>
  154.     class _RWSTDExportTemplate time_get_byname;
  155. template <class charT,
  156.     class OutputIterator _RWSTD_COMPLEX_DEFAULT(ostreambuf_iterator<charT>)>
  157.     class _RWSTDExportTemplate time_put;
  158. template <class charT,
  159.     class OutputIterator _RWSTD_COMPLEX_DEFAULT(ostreambuf_iterator<charT>)>
  160.     class _RWSTDExportTemplate time_put_byname;
  161. template <class charT,
  162.     class InputIterator _RWSTD_COMPLEX_DEFAULT(istreambuf_iterator<charT>)>
  163.     class _RWSTDExportTemplate money_get;
  164. template <class charT,
  165.     class OutputIterator _RWSTD_COMPLEX_DEFAULT(ostreambuf_iterator<charT>)>
  166.     class _RWSTDExportTemplate money_put;
  167. template <class charT, bool Intl _RWSTD_SIMPLE_DEFAULT(false)>
  168.     class _RWSTDExportTemplate moneypunct;
  169. template <class charT, bool Intl _RWSTD_SIMPLE_DEFAULT(false)>
  170.     class _RWSTDExportTemplate moneypunct_byname;
  171. template <class charT> class _RWSTDExportTemplate messages;
  172. template <class charT> class _RWSTDExportTemplate messages_byname;
  173.  
  174.  
  175. #ifndef _RWSTD_NO_NAMESPACE
  176. } // namespace std
  177. #endif
  178.  
  179. #ifndef __STD_RW_LOCIMPL__
  180. #include <rw/locimpl>
  181. #endif
  182.  
  183. #ifndef _RWSTD_NO_NAMESPACE
  184. namespace std {
  185. #endif
  186.  
  187. // -------------
  188. // Class locale.
  189. // -------------
  190.  
  191. class _RWSTDExport locale {
  192.  public:
  193.   class facet;
  194.   class id;
  195.  
  196.   friend class facet;
  197.   friend class id;
  198.  
  199.   typedef int category;
  200.  
  201.   // The following constants identify standard categories of facets.  The
  202.   // standard specifies them as const members of type category (i.e. as const
  203.   // ints).  For compilers that can't initialize const members here, we define
  204.   // them as members of an anonymous enum instead.
  205.  
  206.   // Some compilers get confused by the name collision of these constants with
  207.   // the facet templates collate, ctype and messages.  As a work-around, we
  208.   // also define non-standard names of the form _rw_xxx_category for these
  209.   // three categories.  If you have one of the confused compilers (i.e. if
  210.   // _RWSTD_CONFUSED_ENUM_SCOPE is #defined for you), you must use these non-
  211.   // standard category names.
  212.  
  213.   #ifndef _RWSTD_CONFUSED_ENUM_SCOPE
  214.   #define _RWSTD_CATEGORY_NAMES                              \
  215.     collate = 0x0010, ctype = 0x0020, monetary = 0x0040,    \
  216.     numeric = 0x0080, time  = 0x0100, messages = 0x0200,    \
  217.     all     = 0x03f0, none  = 0x0000
  218.   #else
  219.   #define _RWSTD_CATEGORY_NAMES                              \
  220.     monetary = 0x0040, numeric = 0x0080, time  = 0x0100,    \
  221.     all      = 0x03f0, none  = 0x0000
  222.   #endif
  223.  
  224.   #define _RWSTD_IMPLEMENTATION_VALS                                 \
  225.     _rw_collate_category  = 0x0010, _rw_ctype_category    = 0x0020, \
  226.     _rw_messages_category = 0x0200, _rw_Clib_LC_constants = 0x000F, \
  227.     _rw_num_categories    = 6,      _rw_first_category    = 0x0010
  228.  
  229.   #ifndef _RWSTD_NO_STI_SIMPLE
  230.   static const category _RWSTD_CATEGORY_NAMES, _RWSTD_IMPLEMENTATION_VALS;
  231.   #else
  232.   enum { _RWSTD_CATEGORY_NAMES, _RWSTD_IMPLEMENTATION_VALS };
  233.   #endif
  234.  
  235.   #undef _RWSTD_CATEGORY_NAMES
  236.   #undef _RWSTD_IMPLEMENTATION_VALS
  237.  
  238.   // The default constructor creates a copy of the current global locale.
  239.  
  240.   inline locale () _RWSTD_THROW_SPEC_NULL;
  241.  
  242.   // The copy constructor and assignment operator can be used freely; most of
  243.   // the locale's contents are in a reference-counted implementation object,
  244.   // so copying and assignment involve little overhead.
  245.  
  246.   inline locale (const locale& other) _RWSTD_THROW_SPEC_NULL;
  247.   const locale& operator = (const locale& other) _RWSTD_THROW_SPEC_NULL;
  248.  
  249.   // The following constructor creates a locale composed of by-name facets and
  250.   // assigns it a name.  The valid arguments are "", "C", and a set of strings
  251.   // defined by the compiler vendor.  These cause all the facets of the locale
  252.   // to be obtained, respectively, from the current global locale, from the
  253.   // classic locale, or from the compiler vendor's locale database.  If the
  254.   // argument is not recognized, the constructor throws runtime_error.
  255.  
  256.   _EXPLICIT locale (const char* name);
  257.  
  258.   // The following constructor copies its first argument except for the facets
  259.   // in the categories identified by the third argument, which are obtained
  260.   // from the second argument.
  261.  
  262.   locale (const locale &other, const locale &second, category);
  263.  
  264.   // The following constructor copies its first argument except for the facets
  265.   // in the categories identified by the third argument, which are obtained by
  266.   // name using the second argument.  Can throw runtime_error.
  267.  
  268.   locale (const locale& other, const char* name, category);
  269.  
  270.   // The following templatized constructors are only available if your compiler
  271.   // supports member function templates.  Each copies its first argument except
  272.   // for the single facet of type Facet, which it get from the second argument.
  273.  
  274.   #ifndef _RWSTD_NO_MEMBER_TEMPLATES
  275.  
  276.   template <class Facet>
  277.   inline locale (const locale& other,Facet* f);
  278.  
  279.   #ifndef _RWSTD_NO_TEMPLATE_ON_RETURN_TYPE
  280.   template <class Facet>
  281.   inline locale (const locale& other, const locale& one);
  282.   #endif
  283.  
  284.   #else
  285.  
  286.   // If your compiler does not support member function templates, we provide
  287.   // the following work-around to let you accrete facets onto a locale.  This
  288.   // constructor copies its first argument except for the single facet of the
  289.   // type of the second argument, for which it uses the second argument.
  290.   //
  291.   // To determine the type of the second argument, it calls the non-standard
  292.   // virtual method get_id() in the second argument.  If you are creating your
  293.   // own facet types on a compiler that does not support member templates, you
  294.   // must code a get_id() member as follows in each new base class facet (i.e.
  295.   // in each facet class that has its own static member id of type locale::id):
  296.   //
  297.   //    virtual locale::id &get_id (void) const { return id; }
  298.   //
  299.   // See the get_id members in the standard facets below for examples.
  300.  
  301.   inline locale (const locale& other, facet* f);
  302.  
  303.   #endif // _RWSTD_NO_MEMBER_TEMPLATES
  304.  
  305.   // The destructor is non-virtual.  Other classes are not intended to be
  306.   // derived from locale.
  307.  
  308.   ~locale ()
  309.   {
  310.     __RWSTD::ref_counted::remove_reference(imp_);
  311.   }
  312.  
  313.   // The following returns the locale name, or "*" if the locale is unnamed.
  314.  
  315.   string name () const;
  316.  
  317.   // Two locales are equal if they are the same object, or one is a copy of the
  318.   // other (i.e. they have the same implementation object), or both are named
  319.   // and their names are the same.
  320.  
  321.   bool operator == (const locale& other) const;
  322.   bool operator != (const locale& other) const { return !(*this==other); }
  323.  
  324.   // The following templatized operator () satisfies STL requirements for a
  325.   // comparator predicate template argument for comparing strings according to
  326.   // the collating sequence of the locale.  It lets you use a locale directly
  327.   // as a comparator using syntax like sort(v.begin(),v.end(),loc), where v is
  328.   // a vector of some string type and loc is a locale.  If your compiler does
  329.   // not support member function templates, we provide _EXPLICIT support for
  330.   // string and (if applicable) wstring.
  331.  
  332.   #ifndef _RWSTD_NO_MEMBER_TEMPLATES
  333.   template <class charT, class Traits, class Allocator>
  334.   bool operator() (const basic_string<charT,Traits,Allocator>& s1,
  335.                    const basic_string<charT,Traits,Allocator>& s2) const;
  336.   #else
  337.   bool operator() (const string &s1,const string &s2) const;
  338.   #ifndef _RWSTD_NO_WIDE_CHAR
  339.   bool operator() (const wstring &s1,const wstring &s2) const;
  340.   #endif
  341.   #endif
  342.  
  343.   // Static members.
  344.  
  345.   static locale global (const locale&);  // Replaces the current global locale
  346.   static const locale &classic ();       // Returns the classic "C" locale
  347.  
  348.   // class facet -- base class for locale feature sets.
  349.  
  350.   // Any class deriving from facet that wants to be perceived as a distinct
  351.   // facet, as opposed to a re-implementation of an existing facet, must
  352.   // declare a static member: static std::locale::id id;
  353.  
  354.   class facet: public __RWSTD::facet_imp {
  355.     friend class __RWSTD::locale_imp;
  356.     friend class locale;
  357.    protected:
  358.     _EXPLICIT facet (size_t refs=0,int cat=0):
  359.         __RWSTD::facet_imp(refs,cat) { }
  360.  
  361.     virtual ~facet() { }
  362.  
  363.     #ifdef _RWSTD_NO_MEMBER_TEMPLATES
  364.     virtual id &get_id (void) const=0;
  365.     #endif
  366.  
  367.    private:
  368.     facet (const facet&);           // not defined
  369.     void operator = (const facet&); // not defined
  370.   };
  371.  
  372.   // class id -- facet type identifier.
  373.  
  374.   // This is mostly an implementation class.  It is used internally as an index
  375.   // to find facets within a locale.  Each distinct facet (i.e. each T that can
  376.   // be the parameter of a use_facet<T> call) has a unique static member of type
  377.   // locale::id named id.  The class is made public to enable extension of the
  378.   // set of standard facets.  Objects of this type don't need to be constructed
  379.   // or referenced in any other circumstances.
  380.  
  381.   class id: private __RWSTD::locale_id_imp {
  382.     _RWSTD_FRIEND_USE_HAS_FACET
  383.     friend class locale;
  384. #ifdef  _MSC_VER
  385.    public:
  386. #endif
  387.     #ifndef HPPA_WA
  388.     operator size_t () const { return id_; }
  389.     #else
  390.     operator size_t () const { return __RWSTD::locale_id_imp::id_; }
  391.     #endif
  392.  
  393.     // The private copy constructor and assignment operator help restrict the
  394.     // class to its intended use.  The copy constructor prevents the compiler
  395.     // from generating a do-nothing default constructor, so we provide one.
  396.     // We omit the constructors on compilers that don't support static template
  397.     // members with constructors.
  398.  
  399. #ifndef _RWSTD_NO_STATIC_DEF3
  400.    public:
  401.     id () { }
  402.    private:
  403.     id (const id&);
  404. #endif
  405.    private:
  406.     void operator = (const id&);
  407.   };
  408.  
  409.  private:
  410.  
  411.   // Implementation.
  412.   friend class __RWSTD::locale_imp;
  413.   _RWSTD_FRIEND_USE_HAS_FACET
  414.  
  415. #ifdef _MSC_VER
  416.  public:
  417. #endif
  418.   // The only data member is a pointer to a ref-counted implementation object:
  419.   __RWSTD::locale_imp *imp_;
  420.   typedef __RWSTD::facet_imp *facet_maker_func (int,const char*,size_t);
  421.  
  422.   // The following function retrieves an implicit facet from a cache,
  423.   // or creates one if needed (via call to the passed call-back
  424.   // function), and makes it an _EXPLICIT facet of the locale.
  425.  
  426.   __RWSTD::facet_imp * make__EXPLICIT (const id &facet_id,
  427.     bool ok_implicit, category facet_cat, facet_maker_func maker) const
  428.   {
  429.     __RWSTD::facet_imp *f=NULL;
  430.  
  431.     // Determine whether the implicit facet has by-name or native or classic
  432.     // behavior, based on its category and flags in the locale_imp that track
  433.     // how the locale was constructed (i.e. which categories have which kinds
  434.     // of behavior by default).  And locate the "base" locale_imp where facets
  435.     // with the indicated kind of behavior are cached.
  436.  
  437.     __RWSTD::locale_imp *base;
  438.     if (imp_->named_cats_ & facet_cat)
  439.       base=NULL;
  440.     else if (imp_->native_cats_ & facet_cat)
  441.       base=the_native_locale_;
  442.     else
  443.       base=the_classic_locale_;
  444.  
  445.     if (base) {
  446.       size_t index(facet_id);
  447.       if (index >= base->vec_.size())
  448.         base->vec_.resize(index+1,NULL);
  449.       f=base->vec_[index];
  450.     }
  451.  
  452.     if (!f) {
  453.       #ifndef _RWSTD_NO_BAD_CAST
  454.       _RWSTD_THROW_NO_MSG(!ok_implicit,bad_cast);
  455.       #else
  456.       _RWSTD_THROW(!ok_implicit,runtime_error,__RWSTD::__rw_LocaleNotPresent);
  457.       #endif
  458.  
  459.       #ifdef _RWSTD_MULTI_THREAD
  460.       // Lock on static mutex that protects last_used_id.
  461.       #endif
  462.  
  463.       if (base) {
  464.         size_t index(facet_id);
  465.         if (index >= base->vec_.size())
  466.           base->vec_.resize(index+1,NULL);
  467.         f=base->vec_[index];
  468.       }
  469.  
  470.       if (!f) {
  471.         int t;
  472.         const char *name="";
  473.         if (imp_->named_cats_ & facet_cat) {
  474.           t=2; name=imp_->category_name(facet_cat);
  475.         } else if (imp_->native_cats_ & facet_cat)
  476.           t=1;
  477.         else
  478.           t=0;
  479.  
  480.         f=maker(t,name,0);
  481.  
  482.         if (base && base!=imp_)
  483.           locale(base).install(f,facet_id);
  484.       }
  485.     }
  486.  
  487.     install(f,facet_id);
  488.     return f;
  489.   }
  490.  
  491.   inline __RWSTD::facet_imp *get_facet (size_t) const;
  492.  
  493. #ifdef _MSC_VER
  494.  private:
  495. #endif
  496.  
  497.   void install (__RWSTD::facet_imp *f, const id& i) const;
  498.  
  499.   static __RWSTD::locale_imp *the_classic_locale_;
  500.   static __RWSTD::locale_imp *the_native_locale_;
  501.   static __RWSTD::locale_imp *global_;
  502.  
  503.   // Construct a locale from an implementation object.
  504.   inline _EXPLICIT locale (__RWSTD::locale_imp *m);
  505.  
  506.  private:
  507.   // We have to say private again in case _RWSTD_FRIEND_USE_HAS_FACET evaluated
  508.   // to public:
  509.  
  510.   // Create initial implementation objects.
  511.   static void init ();
  512. };
  513.  
  514. #undef _RWSTD_FRIEND_USE_HAS_FACET
  515.  
  516. // ----------------------------
  517. // Class locale inline members.
  518. // ----------------------------
  519.  
  520. // Private constructor for use by implementation, constructs a locale from
  521. // a locale_imp implementation object.
  522. inline locale::locale (__RWSTD::locale_imp *m): imp_(m) {
  523.   if (!global_) init();
  524.   __RWSTD::ref_counted::add_reference(imp_);
  525. }
  526.  
  527. // Default constructor, returns a copy of the current global locale.
  528. inline locale::locale () _RWSTD_THROW_SPEC_NULL {
  529.   if (!global_) init(); // This is not throw() ... something has to give.
  530.   __RWSTD::ref_counted::add_reference(imp_=global_);
  531. }
  532.  
  533. // Copy constructor.
  534. inline locale::locale (const locale& other) _RWSTD_THROW_SPEC_NULL {
  535.   __RWSTD::ref_counted::add_reference(imp_=other.imp_);
  536. }
  537.  
  538. #ifndef _RWSTD_NO_MEMBER_TEMPLATES
  539.  
  540. // Constructor to accrete or replace a single facet.
  541. template <class Facet>
  542. inline locale::locale (const locale& other, Facet* f)
  543. {
  544.   if (f) {
  545.     imp_=new __RWSTD::locale_imp (*other.imp_,1);
  546.     install(f,Facet::id);
  547.     imp_->named_=false;
  548.   } else
  549.     __RWSTD::ref_counted::add_reference(imp_=other.imp_);
  550. }
  551.  
  552. #ifndef _RWSTD_NO_TEMPLATE_ON_RETURN_TYPE
  553. template <class Facet>
  554. inline locale::locale (const locale& other, const locale& second):
  555.     imp_(new __RWSTD::locale_imp (*other.imp_,1))
  556. {
  557.   const Facet &f=use_facet<Facet>(second);
  558.   install(&f,Facet::id);
  559.   imp_->named_=false;
  560. }
  561. #endif /* _RWSTD_NO_TEMPLATE_ON_RETURN_TYPE */
  562.  
  563. #else
  564.  
  565. inline locale::locale (const locale& other, facet* f):
  566.     imp_(new __RWSTD::locale_imp (*other.imp_,1))
  567. {
  568.   install(f,f->get_id());
  569.   imp_->named_=false;
  570. }
  571.  
  572. #endif // _RWSTD_NO_MEMBER_TEMPLATES
  573.  
  574.  
  575. // Private implementation helper function.
  576. inline __RWSTD::facet_imp* locale::get_facet (size_t i) const {
  577.   return imp_->get_facet(i);
  578. }
  579.  
  580. #ifndef _RWSTD_NO_NAMESPACE
  581. } namespace __rwstd {
  582. #endif
  583.  
  584.  
  585. // -------------------------------------------------------
  586. // Implementation function template -- create_named_facet.
  587. // -------------------------------------------------------
  588. // 
  589. // The default for facets with no derived byname version is to create a facet
  590. // with classic ("C") behavior, ignoring the passed name.
  591.  
  592. template <class Facet>
  593. inline Facet* _RWSTDExport create_named_facet
  594.     (Facet*,const char*,size_t refs)
  595. {
  596.   return new Facet(refs);
  597. }
  598.  
  599. #ifndef _RWSTD_NO_NAMESPACE
  600. } // namespace __rwstd
  601. #endif
  602.  
  603. // Get declarations for vendor-defined extensions, such as 
  604. // declarations of the facets of the native ("") locale.
  605. #include <rw/vendor>
  606.  
  607.  
  608. #ifdef _RWSTD_NO_TEMPLATE_REPOSITORY
  609. #include <rw/rwlocale.cc>
  610. #endif
  611.  
  612. #endif // __STD_RWLOCALE__
  613.  
  614.  
  615. #pragma option pop
  616. #endif /* __RWLOCALE_H */
  617.